<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of EmpleadoDB
 *
 * @author Admin
 */
class BandaDB extends CI_Model {

    var $title = '';
    var $content = '';
    var $date = '';

    function __construct() {
        // Call the Model constructor
        parent::__construct();
    }

    function get_last_ten_entries() {
        $query = $this->db->get('entries', 10);
        return $query->result();
    }

    function Insert_Tab($arrData) {
        
        $this->db->insert('bandas', $arrData);
        /*if(!empty($arrData["f_egr"]))
            $this->db->insert('empleado', $arrData);
        else{
            $arrData["f_egr"] = NULL;
            $this->db->insert('empleado', $arrData);
        }*/
                    
    }
    
    function borrar_tablabanda($item) {
        /*$this->db->where('ficha', $item['eliminar']);
        $this->db->delete('empleado');      */ 
        
        
        $q = $this->db->get_where('bandas', array('n_banda' => $item['eliminar']));
            if ($q->result()) {
            $this->db->where('n_banda',$item['eliminar']);
            $this->db->delete('bandas');
            return TRUE;
            } else { 
            return FALSE;
            }
     
        
    }
    
    
    
    
    function update_entryband($arrData) {
        $this->db->where('n_banda', $arrData['n_banda']);
        $q = $this->db->get('bandas');

        if ($q->num_rows() > 0) {
            $this->db->where('n_banda', $arrData['n_banda']);
            $this->db->update('bandas', $arrData);
            return TRUE;
        }else FALSE;
    }
    

}